<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>生成器</title>
</head>
<body>
    <p>你说：<span id="content"></span></p>
    <input id="sayBtn" type="button" value="say">
    <script>
        let content = document.getElementById("content");
        let sayBtn = document.getElementById("sayBtn");
        function* say(){
            yield "你好";
            yield "我在朗沃学习前端";
            yield "前端太简单了";
            yield "我一下就会了";
        }
        let iterator = say();
        sayBtn.onclick = function(){
            content.innerHTML = iterator.next().value;
        }
    </script>
</body>
</html>